FROM python:3.7-alpine

LABEL wangbin wbyn2008@qq.com

WORKDIR /app
COPY . .
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
    apk update && \
    apk add --no-cache git gcc g++ python3 python3-dev py3-pip mysql-dev openssl bash linux-headers libffi-dev openssl-dev curl wget && \
    bash && \
    ls -l . && ls -al ~/ && \
    export PATH=/root/.local/bin/:$PATH && \
    cd ~ && mkdir -p fisco && cd fisco && \
    curl -#LO https://gitee.com/FISCO-BCOS/FISCO-BCOS/raw/master/tools/build_chain.sh && chmod u+x build_chain.sh && \
    bash build_chain.sh -l "127.0.0.1:4" -p 30300,20200,8545 && \
    cd /app && \
    pip install -r requirements.txt --user && \
    bash init_env.sh -i && \
    cp ~/fisco/nodes/127.0.0.1/sdk/* bin/ && \
    rm /var/cache/apk/*

EXPOSE 20200 30300 8545 5081
CMD ["sh","-c","/app/start.sh"]
